package com.zero.test3;

import java.util.Timer;
import java.util.TimerTask;

public class TimerTest {
    public static void main(String[] args) {
        Timer timer = new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("延迟执行");
            }
        }, 1000L,2000L);//多久开始    隔多久执行一次  1000= 1秒
    }

}
